﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ObviousCode.Stately
{
    public class StateCollection<T> : IEnumerable<T> where T : struct
    {
        T[] _values;

        public StateCollection(params T[] values)
        {
            _values = values;
        }

        public static StateCollection<T> From(params T[] values)
        {
            return new StateCollection<T>(values);
        }

        public IEnumerator<T> GetEnumerator()
        {
            for (int i = 0; i < _values.Length; i++) yield return _values[i];
        }

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }
    }
}
